/**
*  fn_airStrike
*
*  Calls CAS jet to attack passed location
*
*  Domain: Server
**/
params ["_player", "_targetPos"];

//有绿军才触发
if(count call fn_getPlayerGreen != 0)then
{
	//禁止打自己和队友，也防止打贴脸的绿军
	private _end = false;
	
	{
		if(_x distance2D _targetPos < 20)exitWith{_end = true};
	}forEach (call fn_getPlayerRed);

	//此为服务器执行
	if(_end) exitWith{
		[east, "联络员", "附近有你的队友，拒绝执行！请调整坐标。"] remoteExec ["fn_talk", _player];
		[_player, "SupportD21"] remoteExec ["BIS_fnc_addCommMenuItem", _player];
	};
};

//"Fire" remoteExec ["playMusic", east];


[ [format ["精准打击: 正在路上！预计12S后到达坐标点%1。", mapGridPosition _targetPos], "PLAIN"] ] remoteExec ["TitleText", east];//
private _make_name = format ["cas_%1", time/60];
_make = createMarker [_make_name, _targetPos];
_make setMarkerType "hd_objective";
_make setMarkerSize [.8,.8];
_make setMarkerText format ["CAS (%1)", name _player];
_make setMarkerColor "ColorRed";

//绿军隐藏标记
[_make_name, 0] remoteExec ['setMarkerAlphaLocal', resistance];

sleep 12;
deleteMarker _make;


private _scriptedCharge = "Bo_GBU12_LGB" createVehicle _targetPos;
_scriptedCharge setDamage 1;

/*sleep 1;
_scriptedCharge = "Bo_GBU12_LGB_MI10" createVehicle (_targetPos getPos[random 10, random 360]);
_scriptedCharge setDamage 1;

for ("_i") from 1 to 12 do {
sleep 0.2;
_scriptedCharge = "Bo_GBU12_LGB" createVehicle (_targetPos getPos[random 30, random 360]);
_scriptedCharge setDamage 1;
};

sleep 0.3;
_scriptedCharge = "Bo_GBU12_LGB_MI10" createVehicle (_targetPos getPos[random 20, random 360]);
_scriptedCharge setDamage 1;
*/

